package com.jelly.mina.simpleness;

import java.io.IOException;
import java.net.InetSocketAddress;

import org.apache.mina.core.filterchain.DefaultIoFilterChainBuilder;
import org.apache.mina.filter.codec.ProtocolCodecFilter;
import org.apache.mina.filter.codec.textline.TextLineCodecFactory;
import org.apache.mina.transport.socket.SocketAcceptor;
import org.apache.mina.transport.socket.nio.NioSocketAcceptor;


/**
 * ��Mina Serverʾ��
 * @author Jelly
 *
 */
public class MainServer {
	public static void main(String[] args) {
		SocketAcceptor acceptor = new NioSocketAcceptor();
		DefaultIoFilterChainBuilder chain = acceptor.getFilterChain();
		chain.addLast("myChin", new ProtocolCodecFilter(new TextLineCodecFactory()));
		acceptor.setHandler(new SamplMinaServerHandler());
		int bindPort=9988;
		try {
			acceptor.bind(new InetSocketAddress(bindPort));
		} catch (IOException e) {
			e.printStackTrace();
		}
		System.out.println("Mina Server is Listing on:="+bindPort);
	}
}
